<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>CellEdit 单元格编辑 </title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    
    <script src="__PUBLIC__/scripts/boot.js" type="text/javascript"></script> 

</head>
<body>
    <h1>系统会议纪要</h1>
    
    <div style="width:800px;">
        <div class="mini-toolbar" style="border-bottom:0;padding:2px;">
            <table style="width:100%;">
                <tr>
                    <td style="width:100%;">
                        <a class="mini-button" iconCls="icon-add" onclick="addRow()" plain="true">增加</a>
                        <a class="mini-button" iconCls="icon-remove" onclick="removeRow()" plain="true">删除</a>
                        <span class="separator"></span>
                        <a class="mini-button" iconCls="icon-save" onclick="saveData()" plain="true">保存</a>            
                    </td>
                    <td style="white-space:nowrap;">
                        
                    </td>
                </tr>
            </table>           
        </div>
    </div>
    <div id="datagrid1" class="mini-datagrid" style="width:800px;height:500px;" 
        url="__APP__/Value/showmeeting" idField="id"
        allowResize="true" pageSize="20" 
        allowCellEdit="true" allowCellSelect="true" multiSelect="true"
        
    >
        <div property="columns">
            <div type="checkcolumn"></div>
            <div field="pname" width="120" headerAlign="center" allowSort="true">项目名称
                <input property="editor" class="mini-textbox" style="width:100%;" />
            </div> 
           
            <div field="date" width="100" allowSort="true" dateFormat="yyyy-MM-dd">时间
                <input property="editor" class="mini-datepicker" style="width:100%;" dateFormat="yyyy-MM-dd"/>
            </div>
            <div field="content" width="320" headerAlign="center" allowSort="true">内容
                <input property="editor" class="mini-textbox" style="width:100%;" />
            </div> 
              
            </div> 
        </div>
    </div>
    <script type="text/javascript">
      
       

        mini.parse();
        var depart = "{$_SESSION['depart']}";
            if(depart!="系统管理员") {
                mini.alert("此操作仅限系统管理员！", "提示", function() {
                    window.CloseOwnerWindow('refresh');
                });

            }
        var grid = mini.get("datagrid1");
        grid.load();

        //////////////////////////////////////////////////////
        function search() {
            var key = mini.get("key").getValue();
            grid.load({ key: key });
        }
        function onKeyEnter(e) {
            search();
        }
        
        function addRow() {
            var newRow = { name: "New Row" };
            grid.addRow(newRow, 0);
        }
        function removeRow() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                grid.removeRows(rows, true);
            }
        }
        function saveData() {
            var data = grid.getChanges();
            var json = mini.encode(data);
            grid.loading("保存中，请稍后......");            
            $.ajax({
                url: "__APP__/Value/SaveMeeting",
                data: { data: json },
                type: "post",
                success: function (text) {
                	alert("提交成功");
                	grid.reload();
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                }
            });
            
        }
        function CloseWindow(action) {

                if(window.CloseOwnerWindow)
                    window.CloseOwnerWindow(action);
                
                else
                    window.close();

            }
    </script>
        
    </div>
</body>
</html>